<template>
	<view class="main">
		<u-navbar
		:title="title"
		title-size="34"
		back-icon-color="#ffffff"
		title-color="#ffffff"
		:border-bottom="false"
		:background="background">
		</u-navbar>
		<u-tabs-swiper 
		ref="uTabs" 
		:bold='false'
		:list="list" 
		:current="current" 
		@change="Tabchange" 
		:is-scroll="false"
		></u-tabs-swiper>
		<swiper :current="swiperCurrent" @change="changeSwiper">
			<swiper-item class="swiper-item">
				<scroll-view scroll-y class="scroll">
					<block v-for="(item,index) in 5" :key="index">
						<view class="upcoming_item">
							<view class="date">2019-01-01  15:58</view>
							<view class="cont">
								<view class="title">托管通知</view>
								<view class="des">托管费用</view>
								<view class="price">¥1389.00</view>
								<view class="cont_btm">
									<view class="cont_btm_item">
										<text>订单名称:  </text>
										<text>整包项目托管费用(c#开发应用程序后台开发)</text>
									</view>
									<view class="cont_btm_item">
										<text>订单状态:  </text>
										<text>待托管</text>
									</view>
									<view class="cont_btm_item">
										<text>订单编号:  </text>
										<text>202197867579780897</text>
									</view>
								</view>
								<view class="go">
									<button type="default">去处理</button>
								</view>
							</view>
						</view>
					</block>
				</scroll-view>
			</swiper-item>
			<swiper-item class="swiper-item">
				<scroll-view scroll-y class="scroll u-m-t-20 communication_scroll">
					<block v-for="(item,index) in 10" :key="index">
						<view class="communication">
							<view class="cont">
								<view class="user">
									<image src="" mode="" class="avatar"></image>
									<view class="user_cont">
										<view class="name">张小萌</view>
										<view class="des">申请接单</view>
									</view>
								</view>
								<view class="time">21:00</view>
							</view>
						</view>
					</block>
				</scroll-view>
			</swiper-item>
			<swiper-item class="swiper-item">
				<scroll-view scroll-y class="scroll">
					<block v-for="(item,index) in 10" :key="index">
						<WorksItem></WorksItem>
					</block>
				</scroll-view>
			</swiper-item>
		</swiper>
	</view>
</template>

<script>
	import WorksItem from "@/components/WorksItem.vue"
	export default{
		components:{
			WorksItem
		},
		data(){
			return{
				background: {
					backgroundColor:"#4A90E2"
				},
				list: [{
					name: '待办'
				}, {
					name: '沟通'
				}, {
					name: '工作'
				}],
				current: 0,//当前tab
				title:'待办',//标题
				swiperCurrent: 0, //当前swiper
			}
		},
		onLoad(e) {
			console.log('[当前tabs标签]',e)
			if(e.id){
				this.current = Number(e.id)
				this.swiperCurrent = this.current
				this.title = this.list[this.current].name
			}
		},
		onShow() {
			
		},
		onPullDownRefresh() {
		    console.log('refresh');
		    setTimeout(function () {
		        uni.stopPullDownRefresh();
		    }, 1000);
		},
		methods: {
			Tabchange(index) {
				this.current = index;
				this.swiperCurrent = this.current
				this.title = this.list[this.current].name
			},
			changeSwiper(e){
				this.current = e.detail.current
				this.title = this.list[this.current].name
			},
			//跳转
			toPage(url){
				console.log('[跳转]')
				uni.navigateTo({
				    url: url
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.main{
		min-height: 100vh;
		background-color: #f9f9f9;
		uni-swiper{
			height: calc(100vh - 220rpx);
			.scroll{
				height: calc(100vh - 220rpx);
				.upcoming_item{
					padding: 30rpx 22rpx 0 22rpx;
					.date{
						text-align: center;
						font-size: 22rpx;
						font-weight: 400;
						color: #AEAEAE;
						line-height: 30rpx;
						margin-bottom: 32rpx;
					}
					.cont{
						background-color: #FFFFFF;
						padding: 30rpx 20rpx;
						border-radius: 8rpx;
						.title{
							font-size: 28rpx;
							font-weight: 500;
							color: #333333;
							line-height: 40rpx;
							margin-bottom: 45rpx;
						}
						.des{
							font-size: 26rpx;
							font-weight: 400;
							color: #999999;
							line-height: 37rpx;
							margin-bottom: 15rpx;
							text-align: center;
						}
						.price{
							font-size: 72rpx;
							font-weight: 400;
							color: #333333;
							line-height: 100rpx;
							text-align: center;
						}
						.cont_btm{
							margin-top: 48rpx;
							.cont_btm_item{
								font-size: 26rpx;
								font-weight: 400;
								color: #999999;
								line-height: 48rpx;
								text{
									&:last-child{
										color: #333333;
										margin-left: 20rpx;
									}
								}
							}
						}
						.go{
							margin-top: 62rpx;
							text-align: right;
							button{
								display: inline-block;
								width: 168rpx;
								height: 62rpx;
								background: #4A90E2;
								border-radius: 31rpx;
								font-size: 26rpx;
								font-weight: 500;
								color: #FFFFFF;
								line-height:62rpx;
							}
						}
					}
				}
				.communication{
					background-color: #FFFFFF;
					padding: 0 30rpx;
					.cont{
						display: flex;
						align-items: center;
						justify-content: space-between;
						padding: 30rpx 0;
						border-bottom: 1px solid #f9f9f9;
						.user{
							display: flex;
							align-items: center;
							.avatar{
								width: 95rpx;
								height: 95rpx;
								border-radius: 50%;
								border: 1px solid #f9f9f9;
							}
							.user_cont{
								margin-left: 30rpx;
								.name{
									font-size: 32rpx;
									font-weight: 400;
									color: #333333;
									line-height: 32rpx;
								}
								.des{
									font-size: 28rpx;
									font-weight: 400;
									color: #888888;
									line-height: 40rpx;
									margin-top: 17rpx;
								}
							}
						}
						.time{
							font-size: 22rpx;
							font-weight: 400;
							color: #AEAEAE;
							line-height: 30rpx;
						}
					}
				}
				
			}
			.communication_scroll{
				height: calc(100vh - 240rpx);
			}
		}
	}
</style>
